home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
BUSINESS
/
HWKS10.ZIP
/
SETUP.MST
< prev
next >
Wrap
Text File
|
1993-04-29
|
7KB
|
208 lines
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'' This lets us add progman items
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
''Dialog ID's
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST MODELESS = 5000
CONST BADPATH = 6400
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
'' Display the logo bitmap
SetBitmap CUIDLL$, 1
'' read the .INF file
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
ReadInfFile szInf$
'' query user for location to install to
DEST$="c:\hw" ''default destination
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
GOTO GETPATHL1
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
'' specify which files from .INF file should get copied
SrcDir$ = GetSymbolValue("STF_SRCDIR")
'' Get the application HW.EXE
AddSectionFilesToCopyList "HomeWorks", SrcDir$, DEST$
'' Get the support DLL's
AddSectionFilesToCopyList "DLLs", SrcDir$, GetWindowsSysDir()
'' Clean out any old copies of the DLLs hanging around elsewhere
MakeListFromSectionFilename "filenames","DLLs"
nnames%=GetListLength("filenames")
FOR cur%=1 to nnames% STEP 1
f$=GetListItem("filenames",cur%)
win_exist%=DoesFileExist(GetWindowsDir()+f$,femExists)
sys_exist%=DoesFileExist(GetWindowsSysDir()+f$,femExists)
IF (win_exist%=1 AND sys_exist%<>1) THEN
''copy to file from \windows dir to \windows\system
CopyFile GetWindowsDir()+f$,GetWindowsSysDir+f$,cnoNone,0
''delete file from \windows dir
RemoveFile GetWindowsDir()+f$,cmoForce
ELSEIF (win_exist%=1 AND sys_exist%=1) THEN
win_ver$=GetVersionOfFile(GetWindowsDir()+f$)
sys_ver$=GetVersionOfFile(GetWindowsSysDir()+f$)
IF win_ver$>sys_ver$ THEN
''copy to file from \windows dir to \windows\system
CopyFile GetWindowsDir()+f$,GetWindowsSysDir+f$,cnoNone,0
''delete file from \windows dir
RemoveFile GetWindowsDir()+f$,cmoForce
END IF
IF win_ver$=sys_ver$ THEN
''copy to file from \windows dir to \windows\system
CopyFile GetWindowsDir()+f$,GetWindowsSysDir+f$,cnoNone,0
''delete file from \windows dir
RemoveFile GetWindowsDir()+f$,cmoForce
END IF
IF win_ver$<sys_ver$ THEN
''delete file from \windows dir
RemoveFile GetWindowsDir()+f$,cmoForce
END IF
END IF
NEXT cur%
'' Make sure there is available disk space
'' First param is just left as "extra", because we are not
'' expanding any existing files (i.e. adding a K or two to the
'' WIN.INI file. If you use this, add an "Extra" symbol to
'' the symbol table created by AddListitem.
'' Second Parameter identifies a symbol table that the
'' GetCopyListCost function will create for how much space
'' is used by the files to be copied to hard disk.
'' Third Parameter identifies a symbol table that the
'' GetCopyListCost function will create to identify needed
'' disk space.
lRetVal& = GetCopyListCost ( "Extra", "FileCost", "Needed" )
IF lRetVal& > 0 THEN
i% = DoMsgBox ("Insufficient Disk Space", "Setup", 0 )
ClearCopyList
GOTO GETPATH '' Try another directory
END IF
'' Display billboard. "FModelessDlgProc" is the default. The
'' last parameter is irrelevant as long as it is non-zero
'' this is because we only have one billboard.
AddToBillboardList CUIDLL$, MODELESS, "FModelessDlgProc", 1
SetCopyGaugePosition 100, 100
'' copy the files
CopyFilesInCopyList
'' create a progman group
CreateProgmanGroup "HomeWorks", "", cmoNone
ShowProgmanGroup "HomeWorks", 1, cmoNone
CreateProgmanItem "HomeWorks", "HomeWorks", MakePath(DEST$,"hw.exe"), "", cmoOverwrite
CreateProgmanItem "HomeWorks", "HomeWorks Help", "winhelp.exe "+MakePath(DEST$,"hw.hlp"), "", cmoOverwrite
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'*************************************************************************
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION